<%@ page import="com.space.entity.Admin" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理员主界面</title>

    <link rel="stylesheet" href="../js/bootstrap-4.4.1-dist/css/bootstrap.min.css">

    <style type="text/css">
        .body {
            width: 100%;
        }

        .left {
            margin-left: 5px;
            width: 12%;
        }

        .right {
            margin-top: 5px;
            width: 87%;
            float: left;
        }

        .nav-ul {
            width: 80%;
            margin-top: 40px;
            margin-left: 5px;
        }

        li {
            width: 100%;
        }
    </style>

    <script type="text/javascript" src="../js/jquery-3.4.1/jquery-3.4.1.js"></script>

    <script type="text/javascript">
        const weekArr = ["日", "一", "二", "三", "四", "五", "六"];
        $(function () {
            getNowTime();
        });

        function getNowTime() {
            const v1 = new Date();
            const year = v1.getFullYear();
            const month = v1.getMonth() + 1;
            const day = v1.getDate();
            const hour = getCurrencyTime(v1.getHours());
            const minutes = getCurrencyTime(v1.getMinutes());
            const seconds = getCurrencyTime(v1.getSeconds());
            const week = weekArr[v1.getDay()];
            $("#time1").text(year + "年" + month + "月" + day + "日");
            $("#time2").text(hour + ":" + minutes + ":" + seconds + " 星期" + week);
            setTimeout(getNowTime, 1000);
        }

        function getCurrencyTime(time) {
            if (time < 10) {
                return "0" + time;
            } else {
                return time;
            }
        }
    </script>

</head>
<body>
<%
    Admin admin = (Admin) session.getAttribute("adminLogin");
    if (admin == null) {
        response.sendRedirect("adminLogin.jsp");
    }
%>
<div class="top">
    <div class="card bg-dark text-white">
        <div class="card-body">
            <span class="cardName">航空公司营业系统管理员界面</span> <span class="float-right">欢迎${adminLogin.adminAccount}</span>
        </div>
    </div>
</div>
<div class="body">
    <div class="left float-left text-center">
        <div class="time">
            <h5 id="time1">time1</h5>
            <h6 id="time2">time2</h6>
        </div>
        <div class="nav-ul">
            <ul class="nav shadow flex-column">
                <li class="nav-item">
                    <a href="selectFlightByPage.do" class="nav-link" target="right">航班管理</a>
                </li>
                <li class="nav-item">
                    <a href="toFlightCheckJsp.do" class="nav-link" target="right">航班统计</a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" style="display: none" target="right">飞机管理</a>
                </li>
                <li class="nav-item">
                    <a href="getAllUser.do" class="nav-link" target="right">用户管理</a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="exitAdminSystem()">退出系统</a>
                </li>
                <li class="nav-item">&nbsp;</li>
            </ul>
        </div>
    </div>
    <div class="right">
        <iframe name="right" src="toFlightCheckJsp.do" width="100%" height="620" frameborder="0">浏览器版本过低！</iframe>
    </div>
</div>
</body>
<script type="text/javascript" src="../js/bootstrap-4.4.1-dist/js/bootstrap.min.js"></script>

<script type="text/javascript">
    function exitAdminSystem() {
        var v1 = confirm("确认退出吗？");
        if (v1) {
            location.href = "exitAdminSystem.do";
        }
    }
</script>
</html>